<template>
  <div>
    <BasicTable @register="registerTable" :searchInfo="searchInfo"></BasicTable>
  </div>
</template>
<script lang="ts" setup name="sysLog">
import { reactive } from 'vue';
import { BasicTable } from '@/components/table';
import { useBaseTable } from '@/hooks';

import { columns, searchFormSchema } from './data/log.data';
import { Api } from './data/log.api';

const { prefixCls, tableContext, handleDelete, handleSuccess, handlePost, handleBatchDelete } = useBaseTable({
  designScope: 'log-template',
  tableProps: {
    //表格标题
    title: '操作日志列表',
    //主键字段
    rowKey: 'sysLogId',
    //列表查询handler
    handlerName: 'sysLogPageListHandler',
    //列表接口
    listUrl: Api.page,
    //列定义
    columns,
    formConfig: {
      labelWidth: 150,
      schemas: searchFormSchema,
    },
    showActionColumn: false,
  },
});

const [registerTable, { reload }, { rowSelection, hasSelectedRows }] = tableContext;

const searchInfo = reactive<Recordable>({});

function setSearchInfoProps(targetEntity, targetId) {
  searchInfo.targetEntity = targetEntity;
  searchInfo.targetId = targetId;
}

defineExpose({
  setSearchInfoProps,
});
</script>
